package com.time.sky.controller;

import com.time.sky.entity.Finfo;
import com.time.sky.mapper.FinfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/Finfo")
public class FinfoController {
    @Autowired
    private FinfoMapper finfoMapper;
    @ResponseBody
    @RequestMapping("/select")
    public List<Finfo> selectList(){   return finfoMapper.selectList(); }
    @RequestMapping("/add")
    public void add(Finfo finfo){
        finfoMapper.add(finfo);
    }
    @RequestMapping("/delete/{fid}")
    public void delete(@PathVariable("fid") int fid){
        finfoMapper.delete(fid);
    }
    @RequestMapping("/get/{fid}")
    public Finfo getById(@PathVariable("fid") int fid){ return finfoMapper.getById(fid); }
    @RequestMapping("/update")
    public void update(Finfo finfo){
        finfoMapper.update(finfo);
    }
    @ResponseBody
    @RequestMapping("/rows")
    public int rows(){
        return finfoMapper.getRowCount();
    }
}
